package opertation;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * 查找书籍
 */
public class FindOpertation implements IOPertation{
    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入查找的书名");
        String name = scanner.nextLine();
        int sizeof = bookList.getBooksSizeof();
        for(int i = 0 ;i < sizeof;i++) {
            Book book = bookList.getBook(i);
            if(book.getName().equals(name)) {
                System.out.println("找到了 信息如下：");
                System.out.println(book);
                return ;
            }
        }
        System.out.println("没找到 ！！！！");
    }
}
